<template>
  <div class="header">
    <span v-if="title" class="nowrap">{{ title }}</span>
    <span v-if="itemList.length !== 0">(</span>
    <div v-for="(item, index) in itemList" :key="index" class="item nowrap">
      <span>{{ item.label }}</span>
      <span class="point" :style="{ background: item.color }" />
      <span v-if="index + 1 !== itemList.length">/</span>
    </div>
    <span v-if="itemList.length !== 0">)</span>
  </div>
</template>

<script>
export default {
  name: 'HeaderPoint',
  props: {
    itemList: {
      type: Array,
      default: () => []
    },
    title: {
      type: String,
      default: ''
    }
  }
}
</script>

<style lang="scss" scoped>
.header {
  display: flex;
  flex-wrap: nowrap;
  padding: 10px;
  .nowrap {
    font-size: var(--font-size-base);
  }
  .point {
    display: inline-block;
    margin-left: 2px;
    width: 12px;
    height: 12px;
  }
}
</style>
